package com.whu.waterworks.util;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.whu.waterworks.model.TWaterplantdata;
/**
 * 得到对象的属性名
 * @author wangying
 *
 */
public class GetObjectName {
	
	public static Map<String, String> mapsMap =null;
	
	 /** 
	    * 获取属性名数组 
	    * */  
	   public static List<String> getFiledName(Object o){  
	    Field[] fields=o.getClass().getDeclaredFields();  
	      List<String>  fieldNames = new ArrayList<>();
	    for(int i=0;i<fields.length;i++){  
	        fieldNames.add(fields[i].getName());
	        //System.out.println("对象名："+fieldNames[i]);  
	    }  
	    return fieldNames;  
	   }  
	   
	   public static void zuhe(Object o,List<String> list)
	   {
		   mapsMap = new HashMap<>();
		   List<String> temp = getFiledName(o);
		   for(int i=0;i<list.size();i++)
		   {
			   System.out.println("********************GETOBject Name temp="+temp.get(i+1)+"   list="+list.get(i));
			   mapsMap.put(temp.get(i+1), list.get(i));
		   }
	   }
	   
	
}
